//
//  ZTMenuTableViewController.m
//  zhibo8
//
//  Created by zzt on 16/11/20.
//  Copyright © 2016年 zzt. All rights reserved.
//

#import "ZTMenuTableViewController.h"

@interface ZTMenuTableViewController ()<UITableViewDelegate>
/** <#说明#>*/
@property (nonatomic, strong)NSArray *array;
@end

@implementation ZTMenuTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.array = @[@"🏠个人中心",@"💰QQ钱包",@"🐷个性装扮",@"👋我的收藏",@"🐘我的相册",@"📃我的文件",@"📛我的名片夹",@"📛我的名片夹",@"📛我的名片夹"];
    
    self.view.backgroundColor = [UIColor colorWithRed:60/255.0 green:53/255.0 blue:15/255.0 alpha:0.8];
    
    //设置headview
    [self setupHeadview];
    
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    //菜单下边的分割线
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, 44, self.view.frame.size.width, 1)];
    line.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:line];
    
    self.tableView.delegate = self;
}

#pragma mark - 设置headview
- (void)setupHeadview {
    UIView *headerView = [[UIView alloc] initWithFrame: CGRectMake(0, 0, 320, 44)];
    self.tableView.tableHeaderView = headerView;
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(50, 5, 80, 44)];
    label.text = @"菜单";
    label.textColor = [UIColor whiteColor];
    [headerView addSubview:label];
}

#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

      return 9;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.backgroundColor = [UIColor clearColor];
    
    UIColor *color = [[UIColor alloc]initWithRed:22/255.0 green:230/255.0 blue:240/255.0 alpha:0.5];
    cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.frame];
    cell.selectedBackgroundView.backgroundColor = color;
    cell.selectionStyle = UITableViewCellSelectionStyleBlue;
    cell.textLabel.text = [self.array objectAtIndex:indexPath.row];
    cell.textLabel.textColor = [UIColor whiteColor];
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPat{
    return 55;
}
@end
